/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/


void control::getSlot1()
{
   int b;
   char a;
   FILE *fp;
   fp = fopen("/root/1","rt+");
   rewind(fp);
   fseek(fp,12,0);
   a=fgetc(fp);
   b=(a-48);
   onoff1->setValue(b);    
   fclose(fp);
}

void control::setSlot1()
{
   int b;
   b=onoff1->value();
   char a;
   a=b%10+'0';
   FILE *fp;
   fp = fopen("/root/1","rt+");
   rewind(fp);
   fseek(fp,12,0);
   fputc(a,fp);  
   fclose(fp);
}

void control::getSlot2()
{
   int b;
   char a,c;
   FILE *fp;
   fp = fopen("/root/1","rt+");
   rewind(fp);
   fseek(fp,32,0);
   a=fgetc(fp);
   b=(a-48);
   onoffbox2->setValue(b);    
   //fclose(fp);
   fseek(fp,58,0);
   a=fgetc(fp);
   fseek(fp,59,0);
   c=fgetc(fp);
   b=(a-48)*10+c-48;
   temperaturebox->setValue(b);    
   fclose(fp);
}

void control::setSlot2()
{
   int b;
   b=onoffbox2->value();
   char a,c,d;
   c=b%10+'0';
   FILE *fp;
   fp = fopen("/root/1","rt+");
   rewind(fp);
   fseek(fp,32,0);
   fputc(c,fp);
   b=temperaturebox->value();
   a=b/10+'0';
   fseek(fp,58,0);
   fputc (a,fp);
   d=b%10+'0';
   fputc (d,fp);   
   fclose(fp);
}
